#include <reg51.h>
#include "delay.h"
#include "lcd1602.h"

unsigned char rec_data = 0;

char char1, char2;

void uart_isr() interrupt 4
{
	if(TI == 1) 
	{
		TI = 0;
	}
	if(RI == 1) 
	{
		RI = 0;
		rec_data = SBUF;
		SBUF = rec_data;
	}
}

void main() 
{
	TMOD = 0x20;//timer1 mode2
	TH1=0xCC;//0xFD;//11.0592MHz 0xFD BAUD=9600
	TL1=0xCC;//0xFD;//12MHz 0xCC BAUD=600
	SCON = 0x50;//uart mode1
	PCON = 0x00; //SMOD bit = 0
	TR1 = 1;//timer1 run
	RI = 0;
	
	EA = 1;
	ES = 1;//enable serial interrupt
	
	LCD_Init();
	while(1)
	{
		LCD_Display(&char1, 1, 0, 1);
		LCD_Display(&char2, 1, 1, 1);
	}
}